import Vue from 'vue'
import axios from 'axios'

axios.interceptors.request.use(function(request){
    var tokenString = localStorage.getItem("login_data") ||"{}"
    var token = JSON.parse(tokenString).token

    if(token){
        request.headers.Authorization = token
    }
    return request
})






axios.interceptors.response.use(function(response){
    return response.data
})


Vue.prototype.$http = axios
export default axios